package com.tongji.seller.command
{ 
	import com.tongji.seller.events.GetTypesEvent;
	import com.tongji.seller.model.TypeModel;
	import com.tongji.seller.service.TypeService;
	
	import org.robotlegs.mvcs.Command;
	
	/**
	 * 
	 * @author jiarong
	 * 
	 */
	public class TypeCommand extends Command
	{
		[Inject]
		public var service:TypeService;
		
		[Inject]
		public var model:TypeModel;
		
		[Inject]
		public var event:GetTypesEvent;
		
		public function TypeCommand()
		{
			super();
		}
		
		override public function execute():void
		{
			switch(event.type)
			{
				case GetTypesEvent.GET_PLACES:
					service.getPlaces();
					break;
				case GetTypesEvent.UPADATE_PLACES:
					model.updatePlaces(event.typeArray);
					break;
				case GetTypesEvent.GET_STYLES:
					service.getStyles();
					break;
				case GetTypesEvent.UPDATE_STYLES:
					model.updateStyles(event.typeArray);
					break;
				default:
					break;
			}						
		}				
	}
}